package com.three.service;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

import com.three.DAO.impl.ConsumInfoDAOImpl;
import com.three.entity.ConsumInfo;
import com.three.entity.MobileCard;

public class PrintConsumInfo {
	ConsumInfoDAOImpl cidi=new ConsumInfoDAOImpl();
	ConsumInfo con=new ConsumInfo();
        public  void printconsuminfo(MobileCard mobilecard) throws Exception {
           cidi.getConsumInfoByNum(mobilecard);
           File file =new File("C:\\Users\\Administrator\\Desktop\\text.txt");
           OutputStreamWriter writer= new OutputStreamWriter(new FileOutputStream(file));
           
        	writer.write(String.valueOf(con.getId()));
        	if(con.getTalkTime()>0) {
        		writer.write(String.valueOf("短信"));	
        		writer.write(String.valueOf(con.getTalkTime()));
        	}else if(con.getSmsCount()>0) {
        		writer.write(String.valueOf("通话"));
        		writer.write(String.valueOf(con.getSmsCount()));
        	}else if(con.getFlow()>0) {
        		writer.write(String.valueOf("流量"));
        		writer.write(String.valueOf(con.getFlow()));
        	}
        	
        		writer.flush();
        		writer.close();
        		
        		
        		
        	}
        	
        	
        	
        	
        }

